#include<stdio.h>
#include<stdlib.h>
void process(){
    long i,m=200,n=20,u,v,max=100;
    FILE *fp=fopen("QUERY.INP","w");
    fprintf(fp,"%ld %ld",n,m);
    for(i=0;i<m;i++){
        u=rand()%(n-8)+1;
        if(rand()%3!=0)fprintf(fp,"\nS %ld %ld",rand()%n+1,rand()%max+1);
        else fprintf(fp,"\nQ %ld %ld",u,rand()%(n-u)+u+1);
    }
    fclose(fp);
}
int main(){
    process();
    return 0;
}
